using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace PhongKham.View
{
    public partial class frmNhomBenh : PhongKham.FrmTemplate
    {
        private DataSet dsNhomBenh = new DataSet();
        PhongKham.Controller.NhomBenhController control = new PhongKham.Controller.NhomBenhController();
        PhongKham.Controller.LoaiBenhController loai = new PhongKham.Controller.LoaiBenhController();

        public frmNhomBenh()
        {
            InitializeComponent();
            DisplayInfo();
        }


        private void DisplayInfo()
        {
            //Load du lieu len combobox
            DataSet dsLoai = loai.GetAll();
            lookupLoai.DataSource = dsLoai.Tables[0];
            lookupLoai.ValueMember = "LB_STT";
            lookupLoai.DisplayMember = "LB_TEN_VIET";

            //Load du lieu len Grid
            dsNhomBenh = control.GetAll();
            gridNhombenh.DataSource = dsNhomBenh.Tables[0];
            gvNhombenh.BestFitColumns();
        }

        public override void PerformSave()
        {
            control.UpdateNhom(dsNhomBenh.Tables[0]);
        }

        public override void PerformRefresh()
        {
            DisplayInfo();
        }
    }
}